﻿import request from '/@/utils/request';
enum Api {
	AddDeviceInfo = '/api/deviceInfo/add',
	DeleteDeviceInfo = '/api/deviceInfo/delete',
	UpdateDeviceInfo = '/api/deviceInfo/update',
	UpdateDeviceInfoSlaves = '/api/deviceInfo/updateSlaves ',
	PageDeviceInfo = '/api/deviceInfo/page',
	DetailDeviceInfo = '/api/deviceInfo/detail',
	GetDeviceGateWayDeviceGateWayIdDropdown = '/api/deviceInfo/DeviceGateWayDeviceGateWayIdDropdown',
	GetDeviceTemplateInfoDeviceTemplateInfoIdDropdown = '/api/deviceInfo/DeviceTemplateInfoDeviceTemplateInfoIdDropdown',
	GetSysOrgTree = '/api/deviceInfo/SysOrgTree',
	RefreshAllDevice = '/api/deviceInfo/RefreshAllDevice',
	RefreshAllDeviceById = '/api/deviceInfo/RefreshAllDeviceById',
}

// 增加设备信息
export const addDeviceInfo = (params?: any) =>
	request({
		url: Api.AddDeviceInfo,
		method: 'post',
		data: params,
	});

// 删除设备信息
export const deleteDeviceInfo = (params?: any) =>
	request({
		url: Api.DeleteDeviceInfo,
		method: 'post',
		data: params,
	});

// 编辑设备信息
export const updateDeviceInfo = (params?: any) =>
	request({
		url: Api.UpdateDeviceInfo,
		method: 'post',
		data: params,
	});
	// 更新设备所有从机信息
export const updateDeviceInfoSlaves = (params?: any) =>
	request({
		url: Api.UpdateDeviceInfoSlaves,
		method: 'post',
		data: params,
	});

// 分页查询设备信息
export const pageDeviceInfo = (params?: any) =>
	request({
		url: Api.PageDeviceInfo,
		method: 'post',
		data: params,
	});

// 详情设备信息
export const detailDeviceInfo = (id: any) =>
	request({
		url: Api.DetailDeviceInfo,
		method: 'get',
		data: { id },
	});

export const getDeviceGateWayDeviceGateWayIdDropdown = () =>
	request({
		url: Api.GetDeviceGateWayDeviceGateWayIdDropdown,
		method: 'get'
	});
export const getDeviceTemplateInfoDeviceTemplateInfoIdDropdown = () =>
	request({
		url: Api.GetDeviceTemplateInfoDeviceTemplateInfoIdDropdown,
		method: 'get'
	});
export const getSysOrgTree = () =>
	request({
		url: Api.GetSysOrgTree,
		method: 'get'
	});

// 更新在线设备信息
export const refreshAllDevice = () =>
	request({
		url: Api.RefreshAllDevice,
		method: 'get',
	});
//addDeviceInfo更新在线设备信息
export const refreshAllDeviceById = (id: any) =>
	request({
		url: Api.RefreshAllDeviceById,
		method: 'get',
		data: { id },
	});